package org.cancer.hadesdata.resource;

import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import org.cancer.hadesdata.controller.FileController;
import org.cancer.hadesdata.model.FileType;
import org.cancer.hadesdata.syno.SynoManager.ImageSize;
import org.springframework.hateoas.Resource;

public class FileTypeResource extends Resource<FileType> {

	public FileTypeResource(FileType source) {
		super(source);
		String fileId = source.getId();
		add(linkTo(methodOn(FileController.class).findComposites(fileId, 0)).withRel("findComposites"));
		add(linkTo(methodOn(FileController.class).fileInfo(fileId)).withRel("fileInfo"));
		add(linkTo(methodOn(FileController.class).download(fileId)).withRel("download"));
		add(linkTo(methodOn(FileController.class).open(fileId)).withRel("open"));
		add(linkTo(methodOn(FileController.class).image(fileId, ImageSize.LARGE.name())).withRel("imageLarge"));
		add(linkTo(methodOn(FileController.class).image(fileId, ImageSize.MEDIUM.name())).withRel("openMedium"));
		add(linkTo(methodOn(FileController.class).image(fileId, ImageSize.ORIGINAL.name())).withRel("openOrginal"));
		add(linkTo(methodOn(FileController.class).image(fileId, ImageSize.SMALL.name())).withRel("openSmall"));
	}
}